REM *************************  CWBP ************************
REM This is the Script file of CWBP
REM Project: SL203
REM Release Date: 2011/08/29
REM Author: WeiLee
REM v0.0010: Init Version. Port from S9E14
REM *******************************************************
REM ********************************************************************
50  FOREIGN PowerSaving(0)
100 SYSTEM KeyEventDisable()
110 LET YES  = 1
120 LET NO   = 0
130 LET lcdprint = "Start WBP Calibration"
140 SYSTEM ScreenString(40,60,lcdprint)
150 SYSTEM delay_us(1000000)

REM ****** Calibration Initialization *************************************
200 LET Loop             = 1
210 LET Picture_Quantity = 1
220 LET StillTH          = 1
230 LET LVTH             = 10
240 LET SaveRaw          = NO
250 LET SavePosition     = NO
260 LET DumpWBP          = NO
270 LET ClearWBP         = NO

REM AutoMode: 0
REM VideoMode: 5
REM PMode:6
280 LET SWITCHMODE_LV    = 6
290 LET DefaultCapResID  = 14
REM ****** WARM UP ********************************************************

300 FOREIGN Resolution(DefaultCapResID)
310 FOREIGN SwitchMode(SWITCHMODE_LV)

395 IF Loop == 0 THEN 540   
400 LET lcdprint = "WBP Loop: "+Loop
410 SYSTEM ScreenString(10,130,lcdprint)
420 SYSTEM delay_us(1000000)

500 FOREIGN ReturnValue = CWBP(Picture_Quantity, StillTH , LVTH , SaveRaw, SavePosition, DumpWBP, ClearWBP)
510 LET Loop = Loop - 1
520 IF ReturnValue == 0 THEN 530 ELSE 700
530 GOTO 395

540 IF ReturnValue == 0 THEN 600 ELSE 700

REM *****PASS case*****
600 FOREIGN Ret = OneCard_FlgSet(1)
610 FOREIGN OneCardTest(1)
620 SYSTEM KeyEventEnable()
630 GOTO 1000

REM *****Fail case*****
700 LET lcdprint = " Calibration Fail "
710 FOREIGN Ret = OneCard_FlgSet(0)
715 FOREIGN KeyReview(0)
720 FOREIGN Ret = OneCard_ErrPrint(lcdprint)
730 SYSTEM KeyEventEnable()

REM Temp solution change back to normal mode
1000 LET TCase=90001
1020 LET P1=1
1080 LET result=0
1090 FOREIGN result=CCD_CCDModuleValidation(TCase,P1,0,0,0,0,0)

2000 END


RUN                                                                                    